<?php
$section = "product";
$titre = _LB_PRODUCTS;
$link = $section;
Session::setBackLink($link);
//create cfer
//Utils::getHomeLink()

$rootPath = array(
	_LB_HOME => APPLICATION_URL_FO,
    _LB_PRODUCTS => APPLICATION_URL_FO."/products/");

$id = Request::getNumber("id");

$cateLeft = Category::getSubItem(0);

$category = new Category();
if($id > 0 && $category->get($id)){
    $smarty->assign('category', $category);
    $subCat = Category::getSubItem($id);
    $smarty->assign('subCat', $subCat);
    $product = new Product();
    $product->getListProductByCatID($id);
    $smarty->assign('product', $product);
    
    $pathName = array();
    Category::getCategoryNamePath($id, $pathName);
    $utils = new Utils();
    for($i = count($pathName);$i>=0;$i--){
        if(isset($pathName[$i]) && is_array($pathName[$i])){
            $item = $pathName[$i];
            $rootPath[$item['TITLE']] = APPLICATION_URL_FO."/products/category/".$item['ID']."/". $utils->RemoveSign($item['TITLE']);    
        }
    }
    $titre .= TITLE_PAGE_SEPARATE . $category->TITLE;
}
$path = array($id);
Category::getCategoryPath($id, $path);
$arrCat = array();
Category::getAllSubItem(0, $arrCat, $path);




$cfer = new Cfer($rootPath);
//print_r($cfer->getCferArray());
Session::setBackCfer($link, $cfer->getCferArray());
$smarty->assign('cfer', $cfer);
$smarty->assign('catLeft', $arrCat);
$smarty->assign('id', $id);
$smarty->assign('titre', $titre);
$smarty->display("products_category.html");